CAPTCHA = {}
{random} = require 'lodash'

do ->
    for k,v of require('fckoa/config/captcha')[1]
        t = []
        for id, secret of v
            t.push id
        CAPTCHA[k] = t

_POS = {}

module.exports = require('fckoa/router') {
get:{

":key":(ctx)->
    {key} = ctx.params
    now = _POS[key] or 0
    li = CAPTCHA[key]
    _POS[key] = now = (now+1)%li.length
    ctx.body = li[now]

}
}
